<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();

for($id=0;$id < count($arResult["ITEMS"]);$id++):

$arResult["ITEMS"][$id]['PREVIEW_PICTURE']['SRC'] = $APPLICATION->IncludeComponent("soulstream:imager", "", Array(
                                 "MODE" => "7",
                                 "RETURN" => "src",
                                 "FILTERTYPE" => "",
                                 "RESIZE_SMALL" => "Y",
                                 "IMAGE" => $arResult["ITEMS"][$id]['PREVIEW_PICTURE']['SRC'],
                                 "FILE_NAME" => "",
                                 "SAVE_DIR" => "/upload/imager/",
                                 "WIDTH" => "236",
                                 "HEIGHT" => "",
                                 "BG" => "",
                                 "QUALITY" => "75",
                                 "ADD_WATERMARK" => "N",
                                 "WATERMARK_PATH" => "",
                                 "WATERMARK_POSITION" => "",
                                 "ADD_CORNER" => "N",
                                 "CORNER_PATH" => "",
                                 "ADD_TEXT" => "N",
                                 "TEXT" => "",
                                 "TEXT_SIZE" => "12",
                                 "TEXT_COLOR" => "#000000",
                                 "TEXT_Y" => "10",
                                 "TEXT_X" => "10",
                                 "TEXT_POSITION" => "br",
                                 "TEXT_ANGLE" => "15",
                                 "FONT_PATH" => "/imager/arial.ttf",
                                 "CACHE_IMAGE" => "Y",
                                 "DEBUG" => "N"
                                        ), false, array("HIDE_ICONS"=>"Y"));

endfor;


CModule::IncludeModule("iblock");

for($id=0;$id < count($arResult["ITEMS"]);$id++):
    $rs=CIBlockElement::GetList(array(), array("ACTIVE"=>"Y","ID"=>$arResult["ITEMS"][$id]["ID"],"IBLOCK_TYPE"=>"catalog"), false, array("nTopCount"=>1), array("TAGS")); 
    while($ar=$rs->GetNext()) 
    {
    	$tags = explode(",",$ar["TAGS"]);
    	$new_tags=array();
    	
    	foreach($tags as $tag):
    		$_GET["tags"]=trim($tag," ");
    		$str_uri = "/search/?";
    		foreach($_GET as $k => $v):
    			$str_uri.="&$k=$v";
    		endforeach;
    		
    		$new_tags[$i]["NAME"]=$tag;
    		$new_tags[$i]["URL"]=$str_uri;
    		$i+=1;
    	endforeach;
    	$arResult["ITEMS"][$id]["TAGS"]=$new_tags;
    }
endfor;
?>